﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
//using LTP.Accounts.Bus;
namespace xxxy.Web.workInfo
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtwid.Text))
			{
				strErr+="wid格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtwname.Text))
			{
				strErr+="姓名格式错误！\\n";	
			}
			if(this.txtwcontent.Text.Trim().Length==0)
			{
				strErr+="工作内容不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtwtime.Text))
			{
				strErr+="提交时间格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtwstate.Text))
			{
				strErr+="审核状态格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtwtype.Text))
			{
				strErr+="工作类型格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int wid=int.Parse(this.txtwid.Text);
			int wname=int.Parse(this.txtwname.Text);
			string wcontent=this.txtwcontent.Text;
			DateTime wtime=DateTime.Parse(this.txtwtime.Text);
			int wstate=int.Parse(this.txtwstate.Text);
			int wtype=int.Parse(this.txtwtype.Text);

			xxxy.Model.workInfo model=new xxxy.Model.workInfo();
			model.wid=wid;
			model.wname=wname;
			model.wcontent=wcontent;
			model.wtime=wtime;
			model.wstate=wstate;
			model.wtype=wtype;

			xxxy.BLL.workInfo bll=new xxxy.BLL.workInfo();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
